package course_9_2.eg;

import java.util.Scanner;

public class Throw {
    public static void main(String[] args) {
        int sum=0;
        while (true) {
            try {
               sum=f();
            } catch (RuntimeException runtimeException) {
                System.out.println(runtimeException.getMessage());
                break;
            }

        }
    }
    static int f()throws RuntimeException{
        Scanner scanner = new Scanner(System.in);
        int a = 0;
        int sum = 0;
        boolean init =true;
        while (true)
        {
            if(false);
            else if (0 < a && a <= 100)
                sum += a;
            else if(init)
                init=false;
            else
                throw new RuntimeException("Sum ends with"+sum);
            System.out.println("Please enter an integer");
            System.out.println("You entered:" + (a = scanner.nextInt()));
            return sum;
        }
    }
}
